<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!-- Copyright (C) 1988-2023 Free Software Foundation, Inc.

Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being "Funding Free Software", the Front-Cover
Texts being (a) (see below), and with the Back-Cover Texts being (b)
(see below).  A copy of the license is included in the section entitled
"GNU Free Documentation License".

(a) The FSF's Front-Cover Text is:

A GNU Manual

(b) The FSF's Back-Cover Text is:

You have freedom to copy and modify this GNU Manual, like GNU
     software.  Copies published by the Free Software Foundation raise
     funds for GNU development. -->
<!-- Created by GNU Texinfo 6.7, http://www.gnu.org/software/texinfo/ -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Dispatch Tables (GNU Compiler Collection (GCC) Internals)</title>

<meta name="description" content="Dispatch Tables (GNU Compiler Collection (GCC) Internals)">
<meta name="keywords" content="Dispatch Tables (GNU Compiler Collection (GCC) Internals)">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<link href="index.html" rel="start" title="Top">
<link href="Option-Index.html" rel="index" title="Option Index">
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
<link href="Assembler-Format.html" rel="up" title="Assembler Format">
<link href="Exception-Region-Output.html" rel="next" title="Exception Region Output">
<link href="Instruction-Output.html" rel="prev" title="Instruction Output">
<style type="text/css">
<!--
a.summary-letter {text-decoration: none}
blockquote.indentedblock {margin-right: 0em}
div.display {margin-left: 3.2em}
div.example {margin-left: 3.2em}
div.lisp {margin-left: 3.2em}
kbd {font-style: oblique}
pre.display {font-family: inherit}
pre.format {font-family: inherit}
pre.menu-comment {font-family: serif}
pre.menu-preformatted {font-family: serif}
span.nolinebreak {white-space: nowrap}
span.roman {font-family: initial; font-weight: normal}
span.sansserif {font-family: sans-serif; font-weight: normal}
ul.no-bullet {list-style: none}
-->
</style>


</head>

<body lang="en">
<span id="Dispatch-Tables"></span><div class="header">
<p>
Next: <a href="Exception-Region-Output.html" accesskey="n" rel="next">Exception Region Output</a>, Previous: <a href="Instruction-Output.html" accesskey="p" rel="prev">Instruction Output</a>, Up: <a href="Assembler-Format.html" accesskey="u" rel="up">Assembler Format</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Option-Index.html" title="Index" rel="index">Index</a>]</p>
</div>
<hr>
<span id="Output-of-Dispatch-Tables"></span><h4 class="subsection">18.20.8 Output of Dispatch Tables</h4>

<p>This concerns dispatch tables.
</p>
<span id="index-dispatch-table"></span>
<dl>
<dt id="index-ASM_005fOUTPUT_005fADDR_005fDIFF_005fELT">Macro: <strong>ASM_OUTPUT_ADDR_DIFF_ELT</strong> <em>(<var>stream</var>, <var>body</var>, <var>value</var>, <var>rel</var>)</em></dt>
<dd><p>A C statement to output to the stdio stream <var>stream</var> an assembler
pseudo-instruction to generate a difference between two labels.
<var>value</var> and <var>rel</var> are the numbers of two internal labels.  The
definitions of these labels are output using
<code>(*targetm.asm_out.internal_label)</code>, and they must be printed in the same
way here.  For example,
</p>
<div class="example">
<pre class="example">fprintf (<var>stream</var>, &quot;\t.word L%d-L%d\n&quot;,
         <var>value</var>, <var>rel</var>)
</pre></div>

<p>You must provide this macro on machines where the addresses in a
dispatch table are relative to the table&rsquo;s own address.  If defined, GCC
will also use this macro on all machines when producing PIC.
<var>body</var> is the body of the <code>ADDR_DIFF_VEC</code>; it is provided so that the
mode and flags can be read.
</p></dd></dl>

<dl>
<dt id="index-ASM_005fOUTPUT_005fADDR_005fVEC_005fELT">Macro: <strong>ASM_OUTPUT_ADDR_VEC_ELT</strong> <em>(<var>stream</var>, <var>value</var>)</em></dt>
<dd><p>This macro should be provided on machines where the addresses
in a dispatch table are absolute.
</p>
<p>The definition should be a C statement to output to the stdio stream
<var>stream</var> an assembler pseudo-instruction to generate a reference to
a label.  <var>value</var> is the number of an internal label whose
definition is output using <code>(*targetm.asm_out.internal_label)</code>.
For example,
</p>
<div class="example">
<pre class="example">fprintf (<var>stream</var>, &quot;\t.word L%d\n&quot;, <var>value</var>)
</pre></div>
</dd></dl>

<dl>
<dt id="index-ASM_005fOUTPUT_005fCASE_005fLABEL">Macro: <strong>ASM_OUTPUT_CASE_LABEL</strong> <em>(<var>stream</var>, <var>prefix</var>, <var>num</var>, <var>table</var>)</em></dt>
<dd><p>Define this if the label before a jump-table needs to be output
specially.  The first three arguments are the same as for
<code>(*targetm.asm_out.internal_label)</code>; the fourth argument is the
jump-table which follows (a <code>jump_table_data</code> containing an
<code>addr_vec</code> or <code>addr_diff_vec</code>).
</p>
<p>This feature is used on system V to output a <code>swbeg</code> statement
for the table.
</p>
<p>If this macro is not defined, these labels are output with
<code>(*targetm.asm_out.internal_label)</code>.
</p></dd></dl>

<dl>
<dt id="index-ASM_005fOUTPUT_005fCASE_005fEND">Macro: <strong>ASM_OUTPUT_CASE_END</strong> <em>(<var>stream</var>, <var>num</var>, <var>table</var>)</em></dt>
<dd><p>Define this if something special must be output at the end of a
jump-table.  The definition should be a C statement to be executed
after the assembler code for the table is written.  It should write
the appropriate code to stdio stream <var>stream</var>.  The argument
<var>table</var> is the jump-table insn, and <var>num</var> is the label-number
of the preceding label.
</p>
<p>If this macro is not defined, nothing special is output at the end of
the jump-table.
</p></dd></dl>

<dl>
<dt id="index-TARGET_005fASM_005fPOST_005fCFI_005fSTARTPROC">Target Hook: <em>void</em> <strong>TARGET_ASM_POST_CFI_STARTPROC</strong> <em>(FILE *<var></var>, <var>tree</var>)</em></dt>
<dd><p>This target hook is used to emit assembly strings required by the target
after the .cfi_startproc directive.  The first argument is the file stream to
write the strings to and the second argument is the function&rsquo;s declaration.  The
expected use is to add more .cfi_* directives.
</p>
<p>The default is to not output any assembly strings.
</p></dd></dl>

<dl>
<dt id="index-TARGET_005fASM_005fEMIT_005fUNWIND_005fLABEL">Target Hook: <em>void</em> <strong>TARGET_ASM_EMIT_UNWIND_LABEL</strong> <em>(FILE *<var>stream</var>, tree <var>decl</var>, int <var>for_eh</var>, int <var>empty</var>)</em></dt>
<dd><p>This target hook emits a label at the beginning of each FDE.  It
should be defined on targets where FDEs need special labels, and it
should write the appropriate label, for the FDE associated with the
function declaration <var>decl</var>, to the stdio stream <var>stream</var>.
The third argument, <var>for_eh</var>, is a boolean: true if this is for an
exception table.  The fourth argument, <var>empty</var>, is a boolean:
true if this is a placeholder label for an omitted FDE.
</p>
<p>The default is that FDEs are not given nonlocal labels.
</p></dd></dl>

<dl>
<dt id="index-TARGET_005fASM_005fEMIT_005fEXCEPT_005fTABLE_005fLABEL">Target Hook: <em>void</em> <strong>TARGET_ASM_EMIT_EXCEPT_TABLE_LABEL</strong> <em>(FILE *<var>stream</var>)</em></dt>
<dd><p>This target hook emits a label at the beginning of the exception table.
It should be defined on targets where it is desirable for the table
to be broken up according to function.
</p>
<p>The default is that no label is emitted.
</p></dd></dl>

<dl>
<dt id="index-TARGET_005fASM_005fEMIT_005fEXCEPT_005fPERSONALITY">Target Hook: <em>void</em> <strong>TARGET_ASM_EMIT_EXCEPT_PERSONALITY</strong> <em>(rtx <var>personality</var>)</em></dt>
<dd><p>If the target implements <code>TARGET_ASM_UNWIND_EMIT</code>, this hook may be
used to emit a directive to install a personality hook into the unwind
info.  This hook should not be used if dwarf2 unwind info is used.
</p></dd></dl>

<dl>
<dt id="index-TARGET_005fASM_005fUNWIND_005fEMIT">Target Hook: <em>void</em> <strong>TARGET_ASM_UNWIND_EMIT</strong> <em>(FILE *<var>stream</var>, rtx_insn *<var>insn</var>)</em></dt>
<dd><p>This target hook emits assembly directives required to unwind the
given instruction.  This is only used when <code>TARGET_EXCEPT_UNWIND_INFO</code>
returns <code>UI_TARGET</code>.
</p></dd></dl>

<dl>
<dt id="index-TARGET_005fASM_005fMAKE_005fEH_005fSYMBOL_005fINDIRECT">Target Hook: <em>rtx</em> <strong>TARGET_ASM_MAKE_EH_SYMBOL_INDIRECT</strong> <em>(rtx <var>origsymbol</var>, bool <var>pubvis</var>)</em></dt>
<dd><p>If necessary, modify personality and LSDA references to handle indirection.
The original symbol is in <code>origsymbol</code> and if <code>pubvis</code> is true
the symbol is visible outside the TU.
</p></dd></dl>

<dl>
<dt id="index-TARGET_005fASM_005fUNWIND_005fEMIT_005fBEFORE_005fINSN">Target Hook: <em>bool</em> <strong>TARGET_ASM_UNWIND_EMIT_BEFORE_INSN</strong></dt>
<dd><p>True if the <code>TARGET_ASM_UNWIND_EMIT</code> hook should be called before
the assembly for <var>insn</var> has been emitted, false if the hook should
be called afterward.
</p></dd></dl>

<dl>
<dt id="index-TARGET_005fASM_005fSHOULD_005fRESTORE_005fCFA_005fSTATE">Target Hook: <em>bool</em> <strong>TARGET_ASM_SHOULD_RESTORE_CFA_STATE</strong> <em>(void)</em></dt>
<dd><p>For DWARF-based unwind frames, two CFI instructions provide for save and
restore of register state.  GCC maintains the current frame address (CFA)
separately from the register bank but the unwinder in libgcc preserves this
state along with the registers (and this is expected by the code that writes
the unwind frames).  This hook allows the target to specify that the CFA data
is not saved/restored along with the registers by the target unwinder so that
suitable additional instructions should be emitted to restore it.
</p></dd></dl>

<hr>
<div class="header">
<p>
Next: <a href="Exception-Region-Output.html" accesskey="n" rel="next">Exception Region Output</a>, Previous: <a href="Instruction-Output.html" accesskey="p" rel="prev">Instruction Output</a>, Up: <a href="Assembler-Format.html" accesskey="u" rel="up">Assembler Format</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Option-Index.html" title="Index" rel="index">Index</a>]</p>
</div>



</body>
</html>
